home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-20
/
rs0422.zip
/
LEVEL1
/
TNC2.AS
< prev
next >
Wrap
Text File
|
1990-11-14
|
9KB
|
286 lines
;/*
; * Copyright 1988 by the Radio Amateur Telecommunications Society
; * and Thomas A. Moulton, W2VY
; *
; * This software may only be modified, copied, distributed or
; * executed for non-profit purposes by individuals operating
; * systems in the Amateur Radio Service. Credit to the
; * author(s) and to the Radio Amateur Telecommunications Society
; * must be made in modules where RATS provided software is used,
; * and in any announcements and documentation.
; *
; * As a non-profit, research and development organization, the
; * Radio Amateur Telecommunications Society distributes software
; * in both executable and source forms. This policy is in place
; * to encourage the development and distribution of OSI-based,
; * networking tools. In order to protect the interests of the
; * Society and the authors, we have placed some conditions
; * of use on the software. Other groups are encouraged
; * to place the same or similar guidelines on
; * software they produce.
; *
; * The Radio Amateur Telecommunications Society reserves the right
; * to specify and alter the terms under which software provided by
; * the Society may be used. This policy is consistent with the
; * objective of uniform and consistent "Open Systems Interconnections."
; *
; * All acceptable Amateur Radio related uses of this software
; * will be outlined in the "ROSE Implementer's Guide". Individuals
; * or organizations wishing to add to, or modify the provisions of
; * the guide to accommodate local or evolutionary requirements
; * should document the proposed change(s) and forward them to the
; * Society. If accepted, written notification will be provided by
; * the Society to the submitting organization or individual(s).
; * The Society will then issue a "ROSE Implementer's Guide Change
; * Notice". Periodically, the Society will re-issue the "ROSE
; * Implementer's Guide" and incorporate the text of the change
; * notices. This procedure has been put in to place to ensure
; * compatibility between systems and to ensure their "Openness"
; * and interoperability.
; *
; * No part of this software may be used in other packages
; * without prior authorization from the author or the Society.
; * Software incorporating this module, all or in part, must be
; * provided to the Society prior to distribution or use by
; * anyone not directly involved in testing of the revised
; * environment. Current releases of the combined software must
; * be provided to the Society in both source and executable
; * forms. Adequate documention to produce an executable module
; * from the provided source must also be included.
; *
; * Non-Amateur Radio non-profit uses may be authorized on a case
; * by case basis. Inquiries for such use may be made in writing
; * to the Society. Non-commercial uses consistent with the
; * general principles of Open Systems Interconnection Reference
; * Model will be generally considered with favor.
; *
; * Commercial licensing of the software is also available based
; * on normal commercial terms. Licensing inquiries should be
; * directed to the Society. Commercial licensing of the standard
; * software will be done in situations which materially benefit
; * the Amateur Radio Packet Network. Additional licensing is
; * reserved by the individual authors.
; *
; * The Radio Amateur Telecommunications Society provides this software
; * on an "as is" basis. The Society assumes no liability for
; * loss incurred through the use of this software. Amateur Radio
; * use of this software implies non-commercial and voluntary
; * development, deployment and use of this software in a "Amateur",
; * non-commercial service. Commercial users are encouraged to
; * inspect their copies of the source code. Source code modification
; * licenses are available if a combined Object and Source Code
; * license was not originally established.
; *
; * The Society may be contacted by writing or calling at:
; *
; * The Radio Amateur Telecommunications Society
; * 206 North Vivyen Street.
; * Bergenfield, New Jersey 07621
; *
; * Telephone: 201-387-8896
; *
; */
;
; System Init for ROM
;
psect text,pure
*INCLUDE RCONFIG.LIB
*INCLUDE STRUCT.LIB
MSYNC EQU 10H
CTS EQU 05H ;SIO RR0 CTS Bit (Mask 20h)
MDCD EQU 08H
MRTS EQU 02H
GLOBAL CLKBIT, TICKCNT, HDLI
POWER_FAIL EQU 0150H
psect text
start: di ;Insure NO int's!!
jp POWER_FAIL ;Power Failure, check memory, etc
jp INIT_HDW ;Set up SDS's based on the machine type
jp INIT_LED ;Init Led's
jp UPD_LED ;Change Led's (toggle)
HALT ;Nothing to do when "halted"
RET
NOP
global amul, brelop, wrelop, csv, cret
RST2: jp (hl) ;for optimizer **********'0010'**************
defm 'TAPR '
RST3: jp amul ;for optimizer **********'0018'**************
defm 'TNC-2'
RST4: jp brelop ;for optimizer **********'0020'**************
defm 'Clone'
RST5: jp wrelop ;for optimizer **********'0028'**************
defm 'W2VY'
defb 0
RST6: jp csv ;for optimizer **********'0030'**************
defm 'ROSE'
defb 0
RST7: ex (sp),hl ;for optimizer **********'0038'**************
pop hl
jp cret
tickcnt: defb 12 ;600 Hz Tick
defw 0 ;Pointer to Terminal baud rate
defw 0 ;Pointer to Radio baud rate byte (SCCBI)
ileds: defb 0 ;Initial LED Pattern
defw SDSI0, SDSI1
global SDS0, SDS1
INIT_HDW: ; Initialize the SIO data structures
LD HL,SDSI0 ;Copy from ROM
LD DE,SDS0 ;To RAM
LD BC,SDSILEN
LDIR
LD HL,SDSI1 ;Copy from ROM
LD DE,SDS1 ;To RAM
LD BC,SDSILEN
LDIR
LD A,MSYNC ;Clock bit for TNC is SYNC
LD (CLKBIT),A ;Save it
LD A,(tickcnt) ;tick is at 1200 hz
LD (TICKCNT),A ;Number of Interrupts/Tick to 10 ms
; Radio Port PTT/DCD is always normal
LD HL,0FF02h ;PTTMSK1=MRTS, PTTMSK2=FF
LD (SDS0+PTTMSK1),HL
XOR A
LD B,A ;DCD is Normal - No Toggle
LD (SDS0+DCDTGL),A
; Is the async port on a NetRom back-to-back cable?
LD A,(SDS1+CPORT) ;Async Port
LD C,A ;Port Address
IN A,(C) ;Get RR0 Status
BIT CTS,A ;CTS ON?
JR NZ,1f ;No, Don't Invert RTS and DCD
LD HL,7D00h ;PTTMSK1=00, PTTMSK2=~MRTS
LD B,MDCD ;Toggle DCD Bit
LD A,(SDS1+WR5REG)
OR MRTS ;Set the Async PTT to the right idle State
LD (SDS1+WR5REG),A
1: LD (SDS1+PTTMSK1),HL ;RTS Handling
LD A,B ;DCD Handling
LD (SDS1+DCDTGL),A
LD IY,SDS0
CALL HDLI
LD IY,SDS1
CALL HDLI
RET
INIT_LED:
LD D,5
LD IY,SDS0 ;Get address of port 0
LD C,(IY+CPORT) ; CON Led
OUT (C),D ;WR 5
LD A,B
AND 80h ; CON Led is High Bit
LD E,A
LD A,(IY+WR5REG) ;Get Current value
AND 7Fh ;Ignore DTR
OR E ;Set DTR
OUT (C),A
LD IY,SDS1 ;Get to SDS1
LD C,(IY+CPORT) ; STA Led
OUT (C),D ;WR 5
LD A,B
AND 40h ;STA Led is second bit
SLA A
LD E,A
LD A,(IY+WR5REG)
AND 7Fh ;Ignore DTR
OR E ;Set DTR
OUT (C),A ;LEDS Now indicate Restart Cause
RET
UPD_LED:
call csv
ld hl,SDS0 ;Get to SDS0
call toggle
ld hl,SDS1 ;Get to SDS1
call toggle
jp cret
toggle:
ld de,CPORT
add hl,de
ld c,(hl) ;Get command port address
ld de,WR5REG-CPORT
add hl,de
ld b,5 ;WR 5
DI
ld a,(hl)
xor 80h
ld (hl),a
out (c),b
out (c),a
EI
ret
GLOBAL SDSI0, SDSI1
SDSI0: DEFB 0 ;Channel number
DEFB 0DCh ;SIO data port
DEFB 0DDh ;SIO control port
DEFW DWAIT0
DEFW TXDELAY0
DEFW SIOBI ;SYNC CONFIG
DEFB SIOBIL ;LEN
DEFB 0 ;Flags
DEFB 0E9h ;WR5REG (DTR Now On, CON)
SDSI1: DEFB 1 ;Channel number
DEFB 0DEh ;SIO data port
DEFB 0DFh ;SIO control port
DEFW DWAIT1
DEFW TXDELAY1
DEFW SIOAI ;ASYNC CONFIG
DEFB SIOAIL ;LEN
DEFB MASYNC+MTIMER+MAFT ;ON A TNC2
DEFB 068h ;WR5REG (DTR is Now Off, STA) RTS Off
; Fixed data
; SIO ASYNC initialization block.
SIOAI: DEFB 18H ;Reset SIO
DEFB 2,0 ;Set Up Interrupt Vector
DEFB 14h ;WR 4 + Reset Ext Intr
DEFB 44H ;16xClk + 1Stop
DEFB 3 ;WR 3
DEFB 0C1H ;8bit + RxEnable
DEFB 5 ;WR 5
DEFB 068H ;DTR Off + 8bit + TxEnable + RTS Off
DEFB 11h ;WR 1 + Reset Ext intr
DEFB 00011111B ;Enable rx, ext ints
SIOAIL EQU $-SIOAI
; SIO SYNC initialization block.
SIOBI: DEFB 18H ;Reset SIO
DEFB 3 ;WR 3
DEFB 11011001B ;8 bits, EnterHunt, RxCRC, RxEnable
DEFB 14h ;WR 4 + Reset Ext Intr
DEFB 00100000B ;SDLC mode, x1 clock
DEFB 5 ;WR 5
DEFB 01101001B ;DTR off, RTS off
DEFB 7 ;WR 7
DEFB 01111110B ;SDLC flag byte
DEFB 11h ;WR 1 + Reset Ext Intr
DEFB 00011111B ;Enable rx, ext ints
DEFB 10000000B ;Reset Tx CRC
SIOBIL EQU $-SIOBI